/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mousemover;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author Vineet
 */
public class GUI{
    private JFrame frame;
    private JLabel label1;
    public GUI(){
        frame = new JFrame("MouseMover");
        label1 = new JLabel();

        frame.add(label1);

        String imagepathinit = new String("src"+File.pathSeparator+"icontarget");
        Image im1 = Toolkit.getDefaultToolkit().createImage(imagepathinit+"5.jpg");
        Image im2 = Toolkit.getDefaultToolkit().createImage(imagepathinit+"10.jpg");
        Image im3 = Toolkit.getDefaultToolkit().createImage(imagepathinit+"20.jpg");
        Image im4 = Toolkit.getDefaultToolkit().createImage(imagepathinit+"50.jpg");
        List<Image> imagelist = new ArrayList<Image>();
        imagelist.add(im1);imagelist.add(im2);imagelist.add(im3);imagelist.add(im4);
        
        frame.setSize(240, 60);
        frame.setResizable(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);

        frame.setIconImages(imagelist);
    }

    public void setText(String text){
        label1.setText(text);
        try{
            //For the message to vanish after 4 seconds.
            Thread.sleep(4*1000);
        }catch(InterruptedException e){

        }
        label1.setText("");
    }

    public int getMin() throws NumberFormatException{
        String minute = JOptionPane.showInputDialog("Input the inteval in minutes");
        return Integer.decode(minute);
    }

}
